import md5 from 'js-md5'
import VueCookies from 'vue-cookies';
import moment from "moment";
import VueClipboard from 'vue-clipboard2'
import echarts from 'echarts'
import 'echarts-liquidfill'
import '../assets/js/china'
import validate from './validate'
import * as lib from './lib';
import request from './request'
import configs from "@/configs";
import htmlToPdf from './htmlToPdf'
import jszip from 'jszip'
export default {
  install(Vue) {
    // post
    Object.defineProperty(Vue.prototype, '$post', { value: request.axiosPublic.$post });
    // get
    Object.defineProperty(Vue.prototype, '$get', { value: request.axiosPublic.$get });
    //delete
    Object.defineProperty(Vue.prototype, '$delete', { value: request.axiosPublic.$delete });
    //put
    Object.defineProperty(Vue.prototype, '$put', { value: request.axiosPublic.$put });
    // md5
    Object.defineProperty(Vue.prototype, '$md5', { value: md5 });
    // coockie存取
    Object.defineProperty(Vue.prototype, '$cookies', { value: VueCookies });
    // 时间转换
    Object.defineProperty(Vue.prototype, '$moment', { value: moment });
    // 校验
    Object.defineProperty(Vue.prototype, '$validate', { value: validate });
    // 剪切复制
    Object.defineProperty(Vue.prototype, '$clipboard', { value: VueClipboard });
    // echarts
    Object.defineProperty(Vue.prototype, '$echarts', { value: echarts });
    // 基础配置
    Object.defineProperty(Vue.prototype, '$configs', { value: configs });
    // PDF导出
    Object.defineProperty(Vue.prototype, '$htmlToPdf', { value: htmlToPdf });
    // zip解压
    Object.defineProperty(Vue.prototype, '$jszip', { value: jszip });

    for (let i in lib) {
      Object.defineProperty(Vue.prototype, i, { value: lib[i] });
    }


  }

}
